from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional
from module_admin.annotation.pydantic_annotation import as_query




class DocModel(BaseModel):
    """
    知识库附属文档信息表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    doc_id: Optional[int] = Field(default=None, description='文档标题')
    rag_id: Optional[int] = Field(default=None, description='知识库id')
    user_id: Optional[int] = Field(default=None, description='用户id')
    doc_name: Optional[str] = Field(default=None, description='文档名称')
    type: Optional[str] = Field(default=None, description='文档类型')
    author: Optional[str] = Field(default=None, description='作者')
    remote_url: Optional[str] = Field(default=None, description='minio地址')
    serect_level: Optional[str] = Field(default=None, description='保密等级')
    status: Optional[str] = Field(default=None, description='状态')
    create_date: Optional[datetime] = Field(default=None, description='上传日期')
    file_name: Optional[str] = Field(default=None, description='文件名')





class DocQueryModel(DocModel):
    """
    知识库附属文档信息不分页查询模型
    """

    begin_time: Optional[str] = Field(default=None, description='开始时间')
    end_time: Optional[str] = Field(default=None, description='结束时间')


@as_query
class DocPageQueryModel(DocQueryModel):
    """
    知识库附属文档信息分页查询模型
    """

    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')


class DeleteDocModel(BaseModel):
    """
    删除知识库附属文档信息模型
    """

    model_config = ConfigDict(alias_generator=to_camel)

    doc_ids: str = Field(description='需要删除的文档标题')
